#! /bin/bash
echo 'Start...'
#protoc --proto_path=$GOPATH/src:. --micro_out=$GOPATH/src/  --go_out=$GOPATH/src/ agent.srv.proto
curDir=$(cd $(dirname $0);pwd)
cd ${curDir}

count=0
files=$(ls *.proto)
for file in $files
do
    echo $file
    let count=count+1
    # protoc --proto_path=$GOPATH/src:. --micro_out=$GOPATH/src/  --go_out=$GOPATH/src/ $file
    protoc --proto_path=. --micro_out=../../../  --go_out=../../../ $file
    buildRet=$?
    if [ 0 -ne ${buildRet} ]; then
        echo "build ${file} is failed, ret = ${buildRet}"
        exit ${buildRet}
    fi
done

echo $count 'files Done!'
